package com.spi.soconversion.orders.conversion;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.spi.soconversion.util.SOCConstants;
import com.spi.soconversion.util.XMLTagConstants;

public class InstallBaseNotes {

	private List<InstallBaseNote> installBaseNoteList = new ArrayList<InstallBaseNote>();
	
	public boolean addInstallBaseNote(InstallBaseNote ibn){
		boolean status = false;
		if(!installBaseNoteList.contains(ibn)) {
			status = installBaseNoteList.add(ibn);
		}
		
		return status;
	}
	
	public boolean removeInstallBaseNote(InstallBaseNote ibn){
		boolean status = false;
		status = installBaseNoteList.remove(ibn);
				
		return status;
	}

	public List<InstallBaseNote> getInstallBaseNoteList(){
		return installBaseNoteList;		
	}
	
	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		if(installBaseNoteList!=null && installBaseNoteList.size()>0)
		{
			sb.append(XMLTagConstants.START_TAG_HBC_NOTES_LIST);
			Iterator<InstallBaseNote> iter=installBaseNoteList.iterator();
    		while(iter.hasNext())
	    	{
    			sb.append(SOCConstants.NEW_LINE);
    			sb.append(iter.next().toString());  
			}
    		sb.append(SOCConstants.NEW_LINE);
    		sb.append(XMLTagConstants.END_TAG_HBC_NOTES_LIST);
    		
		}
		
		return sb.toString();
	}
}
